
const state = () => ({
  address: JSON.parse(uni.getStorageSync('address') || '{}'),
  token: '123',
  userInfo: JSON.parse(uni.getStorageSync('userinfo') || '{}')
})
const mutations = {
  updataAddress (state, data) {
    state.address = data
    this.commit('user/setStorageAdd')
  },
  setStorageAdd (state) {
    uni.setStorageSync('address', JSON.stringify(state.address))
  },
  updataUserInfo (state, data) {
    state.userInfo = data
    this.commit('user/setStorageUserInfo')
  },
  setStorageUserInfo (state) {
    uni.setStorageSync('userinfo', JSON.stringify(state.userInfo))
  }
}
const getters = {
  addr(state) {
    if (state.address.provinceName) {
      return state.address.provinceName + state.address.cityName + state.address.countyName + state.address.detailInfo
    } else {
      return ''
    }
    }
}


export default {
  namespaced: true,
  state,
  mutations,
  getters
}